package com.chatplus.application.aiprocessor.platform.image.sd;

import com.chatplus.application.aiprocessor.platform.image.ImgAiProcessorService;
import com.chatplus.application.aiprocessor.provider.ImgAiProcessorServiceProvider;
import com.chatplus.application.common.logging.SouthernQuietLogger;
import com.chatplus.application.common.logging.SouthernQuietLoggerFactory;
import com.chatplus.application.common.util.RedisUtils;
import com.chatplus.application.domain.dto.SdParamsDto;
import com.chatplus.application.domain.dto.extend.ImgResultDto;
import com.chatplus.application.enumeration.AiPlatformEnum;
import com.chatplus.application.service.draw.SdJobService;
import org.springframework.stereotype.Service;

/**
 * Sd 绘画处理器
 **/
@Service(value = ImgAiProcessorServiceProvider.SERVICE_NAME_PRE + "SD")
public class SdImageProcessor extends ImgAiProcessorService {
    private static final SouthernQuietLogger LOGGER = SouthernQuietLoggerFactory.getLogger(SdImageProcessor.class);
    private static final String SD_JOB = "sd-job";
    private final SdJobService sdJobService;

    public SdImageProcessor(SdJobService sdJobService) {
        this.sdJobService = sdJobService;
    }
    public ImgResultDto process(Object prompt) {
        RedisUtils.publish(SD_JOB, prompt, consumer -> {
           // System.out.println("发布通道 => " + key + ", 发送值 => " + value);
        });
        RedisUtils.subscribe(SD_JOB, SdParamsDto.class, msg -> {
            // System.out.println("订阅通道 => " + key + ", 接收值 => " + msg);
        });
        return null;
    }

    @Override
    public AiPlatformEnum getChannel() {
        return AiPlatformEnum.SD;
    }
}
